package website.seamonster.ethegg.utils;

import website.seamonster.ethegg.service.AssignEggService;

import java.util.Arrays;
import java.util.List;

/**
 * 决定一只蛋的批次
 * Created by 罗海量
 * 2018-07-21 15:49
 */
@lombok.extern.slf4j.Slf4j
public class BatchNumUtils {
    public static int getBatchNumFromCount(long count){
        long _count = count;
        int batchNum = 1;
        for (batchNum=1; batchNum<31; batchNum++){
            _count = _count - BatchNumUtils.bList.get(batchNum-1);
            if (_count<=0){
                break;
            }
        }
        return batchNum;
    }

    public static final List<Long> bList = Arrays.asList(
            100L,
            200L,
            400L,
            800L,
            1500L,
            2800L,
            5200L,
            9600L,
            17700L,
            32600L,
            60000L,
            110400L,
            203100L,
            373600L,
            687200L,
            1264000L,
            2324900L,
            4276200L,
            7865200L,
            14466400L,
            26607900L,
            48939600L,
            90014000L,
            165561600L,
            304515300L,
            560091000L,
            1030168000L,
            1894774400L,
            3485033500L,
            6409976000L);

//    public static void main(String[] args) {
//        System.out.println(BatchNumUtils.getBatchNumFromCount(101L));
//    }

}
